<template>
    <div class="newsContent">
        <h3 class="title">{{info.title}}</h3>
        <p class="subtitle">
            <span>发表时间:{{info.add_time | dateForm}}</span>
            <span>点击次数:{{info.click}}</span>
            
        </p>
        <hr>
        <p class="content" v-html='info.content'></p>
        <comment-box :id1="this.id"></comment-box>
    </div>
</template>
<script>
import {Toast} from 'mint-ui';
import comment from '../subcomponents/comment.vue';
export default {
    data(){
        return {
            id: this.$route.params.id,
            info:{}
        }
    },
    created(){
        this.getNewsinfo();
    },
    methods:{
        getNewsinfo(){
            this.$http.get('http://www.liulongbin.top:3005/api/getnew/'+this.id).then(result => {
                if(result.body.status === 0){
                    this.info = result.body.message[0];
                }else{
                    Toast('获取新闻失败')
                }
            })
        }
    },
    components:{
        'comment-box':comment
    }
}
</script>
<style lang="scss" scoped>
.newsContent{
    padding:0 4px;
    .title{
        color: red;
        font-size: 14px;
        text-align: center;
    }
    .subtitle{
        font-size: 12px;
        color: #cccccc;
        display: flex;
        justify-content: space-between;
    }
    .content{
        img{
            width:100%;
        }
    }
}
</style>